package com.example.mymicaihu.adapter.home;

import android.content.Context;
import android.widget.TextView;

import com.example.mvplibrary.adapter.BaseAdapter;
import com.example.mvplibrary.adapter.BaseViewHolder;
import com.example.mymicaihu.R;
import com.example.mymicaihu.bean.FocusNewsBean;

import java.util.List;

import jaydenxiao.com.expandabletextview.ExpandableTextView;


/**
 * 作者：朱勇闯
 * data : 2021/4/25  17:02
 * 作用： xxxx
 */
public class FocusNewsListAdapter extends BaseAdapter<FocusNewsBean.DataBean.NewsBean> {
    public ItemListener itemListener;

    public void setItemListener(ItemListener itemListener) {
        this.itemListener = itemListener;
    }

    public FocusNewsListAdapter(List<FocusNewsBean.DataBean.NewsBean> datas, Context context, int layoutId) {
        super(datas, context, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, FocusNewsBean.DataBean.NewsBean listBean, int position) {
        TextView time = holder.getView(R.id.tv_time_focusList);
        ExpandableTextView desc = (ExpandableTextView) holder.getView(R.id.tv_desc_focusList);
        TextView title = holder.getView(R.id.tv_title_focusList);
        time.setText(listBean.getArticleTime());
        title.setText(listBean.getArticleTitle());
        desc.setText(listBean.getArticleSummary());
//在ListView/RecyclerView中的应用
    }

    public interface ItemListener {
        void onItemClickListener(int pos);
    }
}
